package com.zto.mybatis.custom;

import java.lang.reflect.Proxy;

/**
 * Created by xingyuchao on 2017-07-04.
 */
public class MySqlSession {

    private Executor executor = new SimpleExecutor();

    public <T> T selectOne(String statement, Object parameter){
       return  executor.query(statement, parameter);
    }

    public <T> T getMapper(Class<T> clazz){
        return (T) Proxy.newProxyInstance(clazz.getClassLoader(),new Class[]{clazz}, new MapperProxy<T>(this,clazz));
    }
}
